//some keystroke-savers :)
function view(args) {
	return Ti.UI.createView(args);
}

function label(args) {
	return Ti.UI.createLabel(args);
}

function image(args) {
	return Ti.UI.createImageView(args);
}

function window(args) {
	return Ti.UI.createWindow(args);
}

function button(args,onclick) {
	var btn = Ti.UI.createButton(args);
	btn.addEventListener('click', onclick);
	return btn;
}

function urls() {
	var urls = [];
	
	urls['go'] = 'images/go.png';
	urls['go_off'] = 'images/go_off.png';
	urls['stop'] = 'images/stop.png';
	urls['stop_off'] = 'images/stop_off.png';
	urls['yield'] = 'images/yield.png';
	urls['yield_off'] = 'images/yield_off.png';
	urls['bg_gradient'] = 'images/bg_gradient.png';
	urls['bg_clear'] = 'images/bg_clear.png';
	urls['none'] = 'images/none.png';

	return urls;
}

function images() {
	var images = [];
	var urls = urls();
	
	images['go'] = Util.image({image:urls['go']}).toBlob();
	images['go_off'] = Util.image({image:urls['go_off']}).toBlob();
	images['stop'] = Util.image({image:urls['stop']}).toBlob();
	images['stop_off'] = Util.image({image:urls['stop_off']}).toBlob();
	images['yield'] = Util.image({image:urls['yield']}).toBlob();
	images['yield_off'] = Util.image({image:urls['yield_off']}).toBlob();
	images['bg_gradient'] = Util.image({image:urls['bg_gradient']}).toBlob();
	images['bg_clear'] = Util.image({image:urls['bg_clear']}).toBlob();
	images['none'] = Util.image({image:urls['none']}).toBlob();
	
	return images;
}

var db = Titanium.Database.install('starter.db','localDB');

//Public Module API
exports.window = window;
exports.view = view;
exports.label = label;
exports.image = image;
exports.button = button;
exports.images = images;
exports.localDb = db;	
exports.urls = urls;